<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Writing code in and around V-REP</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../index.html" TARGET="_top"><img src="images/homeImg.png"></a></p>



<h1>Writing code in and around CoppeliaSim</h1>

<p>CoppeliaSim is a highly customizable simulator: every aspect of a <a href="simulation.htm">simulation</a> can be customized. Moreover, the simulator itself can be customized and tailored so as to behave exactly as desired. This is allowed through an elaborate <a href="apisOverview.htm">Application Programming Interface</a> (API). 6+ different programming or coding approaches are supported, each having particular advantages (and obviously also disadvantages) over the others, but all six are mutually compatible (i.e. can be used at the same time, or even hand-in-hand). The control entity of a <a href="models.htm">model</a>, <a href="scenes.htm">scene</a>, or the simulator itself can be located inside:<br>
</p>

<li>an <a href="scripts.htm">embedded script</a> (i.e. customizing a simulation (i.e. a <a href="scenes.htm">scene</a> or <a href="models.htm">models</a>) via scripting): this method, which consists in writing <a href="http://www.lua.org">Lua</a> scripts, is very easy and flexible, with guaranteed compatibility with every other default CoppeliaSim installations (as long as customized Lua-commands are not used, or are used with distributed <a href="plugins.htm">plugins</a>). This method allows customizing a particular simulation, a simulation scene, and to a certain extent the simulator itself. This is the easiest and most used programming approach.</li>

<li>an <a href="addOns.htm">add-on</a> or <a href="sandboxScript.htm">the sandbox script</a>: this method, which consists in writing <a href="http://www.lua.org">Lua</a> scripts, allows to quickly customize the simulator itself. Add-ons (or the sandbox script) can start automatically and run in the background, or they can be called as functions (e.g. convenient when writing importers/exporters). Add-ons should not be  specific to a certain simulation or model, they should rather offer a more generic, simulator-bound functionality.<br>
</li>

<li>a <a href="plugins.htm">plugin</a> (i.e. customizing the simulator and/or a simulation via a plugin): this method basically consists in writing a plugin for CoppeliaSim.  Oftentimes, plugins are only used to provide a simulation with <a href="apiFunctions.htm#customizingLuaFunctions">customized Lua commands</a>, and so are used in conjunction with the first method. Other times, plugins are used to provide CoppeliaSim with a special functionality requiring either fast calculation capability (scripts are most of the time slower than compiled languages),  a specific  interface to a hardware device (e.g. a real robot), or a special communication interface with the outside world.<br>
</li>

<li>a <a href="remoteApiOverview.htm">remote API</a> client (i.e. customizing the simulator and/or a simulation via a remote API client application): this method allows an external application (e.g. located on a robot, another machine, etc.) to connect to CoppeliaSim in a very easy way, using remote API commands.</li>

<li>a <a href="rosInterfaces.htm">ROS node</a> (i.e. customizing the simulator and/or a simulation via a ROS node): this method allows an external application (e.g. located on a robot, another machine, etc.) to connect to CoppeliaSim via <a href="http://www.ros.org">ROS</a>, the Robot Operating System.</li>


<li>a node talking <a href="meansOfCommunication.htm#sockets">TCP/IP</a>, <a href="meansOfCommunication.htm#zmq">ZeroMQ</a>, etc.: this method allows an external application (e.g. located on a robot, another machine, etc.) to connect to CoppeliaSim via various communication means.</li>


<p><a name="sixMethods" id="sixMethods"></a>
Above 6 methods are also discussed in the <a href="externalControllerTutorial.htm">external controller tutorial</a>. Following table describes in detail the respective advantages and disadvantages of each method:
</p>

<p align=center><img src="images/controlEntities.jpg"></p>
<p class=imageLabel>[Possible control methods in and around CoppeliaSim]</p>
<br>




<br>
<br>
 </tr>
</table> 
</div>  
  
  
</body>

</html>
